package train48days;

import java.util.Arrays;
import java.util.Scanner;

public class 最长升序子列 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int n = sc.nextInt();
            int[] arr = new int[n];
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                res[i] = 1;
            }
            for (int i = 1; i < n; i++) {
                for (int j = 0; j < i; j++) {
                    if(arr[i] > arr[j]){
                        res[i] = Math.max(res[i],1 + res[j]);
                    }
                }
            }
            Arrays.sort(res);
            System.out.println(res[n-1]);
        }
    }
}
